package com.sc.nft.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.entity.dto.DaoSchoolHomeArticleListDTO;
import com.sc.nft.entity.vo.DaoSchoolTopHomeArticlePageVO;
import com.sc.nft.service.DaoSchoolArticleChildService;
import com.sc.nft.sup.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 文章表与子分类关联表(DaoSchoolArticleChild)表控制层
 *
 * @author makejava
 * @since 2023-03-13 16:21:22
 */

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("daoSchoolArticleChild")
@Api(tags = "文章关联")
public class DaoSchoolArticleChildController {

    /**
     * 服务对象
     */
    private final DaoSchoolArticleChildService daoSchoolArticleChildService;

    @ApiOperation(value = "获取子集的文章", notes = "获取子集的文章", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/getHomeArticleList", produces = MediaType.APPLICATION_JSON_VALUE)
    public PageResult<Page<DaoSchoolTopHomeArticlePageVO>> getHomeArticleList(@RequestBody DaoSchoolHomeArticleListDTO dto) {
        return PageResult.success(daoSchoolArticleChildService.getHomeArticleList(dto));
    }

}
